package com.jingmi.jingmiliving.commodity.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.jingmi.common.Validated.EnumValidate;
import com.jingmi.common.Validated.saveValidatedGroup;
import com.jingmi.common.Validated.updateIsShowValidateGroup;
import com.jingmi.common.Validated.updateValidatedGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 家居品牌
 * 
 * @author jingmi
 * @email 2771368705@qq.com
 * @date 2023-10-06 15:20:58
 */
@Data
@TableName("commodity_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@NotNull(groups = {updateValidatedGroup.class, updateIsShowValidateGroup.class},message = "修改要求指定的id")
	@Null(groups = {saveValidatedGroup.class}, message = " 添加不能指定 id")
	@TableId
	private Long id;
	/**
	 * 品牌名
	 */
	@NotBlank(groups = {saveValidatedGroup.class,updateValidatedGroup.class},
			message = "品牌名不能为空")
	private String name;
	/**
	 * logo
	 */
	@NotBlank(groups = {saveValidatedGroup.class},
			message = "logo 不能为空")
	@URL(groups = {saveValidatedGroup.class,updateValidatedGroup.class},
			message = "logo 不是一个合法的 url")
	private String logo;
	/**
	 * 说明
	 */

	private String description;
	/**
	 * 显示
	 */
	@NotNull(groups = {saveValidatedGroup.class,updateValidatedGroup.class},
			message = "显示状态不能为空")
	@EnumValidate(groups = {saveValidatedGroup.class, updateValidatedGroup.class, updateIsShowValidateGroup.class},
	message = "状态值只能是0或1",values = {0,1})
	private Integer isShow;
	/**
	 * 检索首字母
	 */
	@NotBlank(groups = {updateValidatedGroup.class},message = "检索字母不能为空")
	@Pattern(groups = {saveValidatedGroup.class,updateValidatedGroup.class},
			regexp="^[a-zA-Z]$",message = "检索字母必须是一个字母")
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = {saveValidatedGroup.class},message = "排序值不能为空")
	@Min(groups = {saveValidatedGroup.class,updateValidatedGroup.class},value = 0,message = "排序值要求大于等于 0")
	private Integer sort;

}
